<?php
    /**
    * index.php
    * 
    * @author Osuvaldo Ramos <xdracox@gmail.com>
    * @copyright Copyright (c) 2008, Osuvaldo Ramos
    * @license http://www.opensource.org/licenses/bsd-license.php
    * @package Atman
    */
    
    require_once 'config.php';
    
    /**
    * This function is run by PHP to automagically load class files.
    * @param string $className  The name of the class to load.
    * @return void
    * @package Atman
    */
    function __autoload($className)
    {
        if ( substr($className, 0, 3) == 'AT_' )
        {
            $file = str_replace('_', '/', substr($className, 2));
            $file = AT_ROOT.'/lib'.$file.'.php';
            if ( file_exists($file) )
            {
                require_once $file;
            }
        }
    }
    
    $module = $_GET['m'];
    $app = isset($_GET['a']) ? $_GET['a'] : $module;
    $event = isset($_GET['e']) ? $_GET['e'] : '__default';
    
    $controller = new AT_Controller($module, $app, $event);
    $controller->start();
?>
